<template>
  <el-form-item :prop="prop" :label="label">
    <el-input-number v-bind="$attrs" :disabled="!isEdit" clearable :style="inputStyle" :min="0" :max="999999"
      :controls="false">
      <template #suffix>
        <slot name="suffix" />
      </template>
    </el-input-number>
  </el-form-item>
</template>

<script lang="ts" setup>
/* 简化表单中input的代码
使用 
<MkInputNumber label='附件' v-model='ctx.entity.fuJianMingCheng' prop='fuJianMingCheng' :isEdit='ctx.isEdit' />
*/
import { getInputWidth } from './shared';
defineOptions({
  name: 'MkInputNumber'
})

const props = defineProps({
  prop: {
    type: String,
  },
  label: {
    type: String,
  },
  isEdit: {
    type: Boolean,
    default: true
  },
  col: { // 控制宽度, 最多设置为3, 特殊情况可以设置为4
    type: Number,
    default: 1.1
  },
})

const { inputStyle } = getInputWidth(props.col);

</script>

<style lang='scss' scoped>
.el-input-number {
position: relative;
vertical-align: middle;
width: 171px;
}

</style>